Q: When are the script phases (i.e. @Hangup, @Answer, @ORIGINATE) started?
A: After being attached to the line, LineShare starts the @Hangup phase. If it fails (EXIT <error code>), LineShare restarts the @Hangup phase. This can take place when the modem is switched off.
When the @Hangup phase is completed (EXIT 0), LineShare starts the @ANSWER phase.
Note: both @Hangup and @Answer entry points MUST be present in a script.
The @Answer phase can end with the "ATTACH" operator. If this operator fails (the desired subPort can not be attached - it is not opened, it doesn't send the ATA command, etc), or if the @Answer phase fails - in any case LineShare returns to the @Hangup phase.
When an application using a subPort sends the "ATD" command, LineShare originates the call for it. First it checks that the call can be originated (i.e. the line is not attached to some other port), then it starts the @Hangup phase again. If the @Hangup phase is running, it is NOT interrupted and restarted. In the LineShare control panel this stage is shown as "prepearing to originate a call". If this phase ends OK, the @ORIGINATE <subPort name> phase is started. If this phase fails, the dialing process is interrupted, a message is sent to the application and LineShare starts the @Hangup phase.
If any application opens the "mainPort", LineShare checks that the line is not attached to a subPort, then starts the @Hangup phase to reset the modem. If this stage fails, it is not restarted - all return codes are ignored here, and the line is attached to the main port. After the mainPort closed, LineShare restarts line monitoring starting the @Hangup phase.
Q: How does LineShare process the AT commands sent to a subPort?
A: LineShare stores all those commands in the internal FIFO buffer and emulates the modem responses. These commands can be used in the ORIGINATE phase, with EMITSTART/EMITCOMMAND/EMITCLEAR operators. In the ANSWER phase the LineShare script should sent the necessary commands to the modem itself, so it can receive incoming calls of all types.
Q: How can I debug the @Hangup phase of my LineShare script? When I attach subports using my script, LineShare reports the error immediately, and I have no chance to press the debug button.
A: Press the Debug button when the script has been already stopped: the debug window shows the script operator that resulted in the error. If it is not enough, start any communication application to open the main port. When the main port is opened and LineShare is not monitoring the line, press the Stop button in the LineShare control panel. Switch back to the communication application and close the main port: LineShare resumes line monitoring with @Hangup phase. Since the stop button was pressed, the script is suspended and you can trace it step-by-step.
Q: What should my script do if the modem doesn't respond?
A: @ORIGINATE and @ANSWER phase should end with the proper error code. The @Hangup phase should try to reset the modem: if can be in the data-mode, so you should do your best to return it into the command mode. Make several attempts.
Note: sometimes the @Hangup phase is called syncronously (when an application opens the main port, when you detach subports, etc). In this case LineShare starts the @Hangup phase and gives it 20 secs to complete. If the @Hangup phase is not completed in that time, it is interrupted.